using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using Entities;
using DAL;
using System.Data.SqlClient;
using System.Data;

namespace BUS
{
    public class tbDoanhNghiepBUS
    {
        public static void Insert(tbDoanhNghiepEntities DN)
        {
            tbDoanhNghiepDAL DNDAL = new tbDoanhNghiepDAL();
            DNDAL.Insert(DN);
        }

        public static void Update(tbDoanhNghiepEntities DN)
        {
            tbDoanhNghiepDAL DNDAL = new tbDoanhNghiepDAL();
            DNDAL.Update(DN);
        }

        public static void Delete(int iD)
        {
            tbDoanhNghiepDAL DNDAL = new tbDoanhNghiepDAL();
            DNDAL.Delete(iD);
        }

        public static Entities.tbDoanhNghiepEntities.tbDoanhNghiepColection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbDoanhNghiepDAL DNDAL = new tbDoanhNghiepDAL();
            return DNDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }

        public static Entities.tbDoanhNghiepEntities.tbDoanhNghiepColection GetAll()
        {
            int total = 0;
            tbDoanhNghiepDAL DNDAL = new tbDoanhNghiepDAL();
            return DNDAL.Get("where 1=1", 0, 0, Entities.tbDoanhNghiepEntities.tbDoanhNghiepColumns.MaDN.ToString(), "ASC", out total);
        }

        public static tbDoanhNghiepEntities GetByID(int iD)
        {
            int total = 0;
            tbDoanhNghiepDAL DNDAL = new tbDoanhNghiepDAL();
            Entities.tbDoanhNghiepEntities.tbDoanhNghiepColection DNCollection = DNDAL.Get("where " + Entities.tbDoanhNghiepEntities.tbDoanhNghiepColumns.MaDN.ToString() + "=" + iD.ToString(), 0, 0, Entities.tbDoanhNghiepEntities.tbDoanhNghiepColumns.MaDN.ToString(), "ASC", out total);
            if (DNCollection.Count > 0)
                return DNCollection[0];
            return null;
        }

        public static Boolean KTDoanhNghiep(string user, string pass)
        {
            tbDoanhNghiepDAL DoanhNghiepDAL = new tbDoanhNghiepDAL();
            return DoanhNghiepDAL.KTDoanhNghiep(user, pass);
        }
        public static Boolean KTDoanhNghiep2(string user)
        {
            tbDoanhNghiepDAL DoanhNghiepDAL = new tbDoanhNghiepDAL();
            return DoanhNghiepDAL.KTDoanhNghiep2(user);
        }
    }
}
